package de.szut.ita13sommerfeld.apacheanalyser.apachelog;

import de.szut.ita13sommerfeld.apacheanalyser.components.ApacheComponent;
import de.szut.ita13sommerfeld.apacheanalyser.libaries.EntryLibary;
import de.szut.ita13sommerfeld.apacheanalyser.libaries.MethodLibary;
import de.szut.ita13sommerfeld.apacheanalyser.libaries.ResourceLibary;
import de.szut.ita13sommerfeld.apacheanalyser.libaries.StatusLibary;
import de.szut.ita13sommerfeld.apacheanalyser.libaries.UserLibary;
import de.szut.ita13sommerfeld.apacheanalyser.reader.ApacheReader;

public class ApacheLog implements ApacheComponent {
	
	/**
	 * @author Rene Sommerfeld
	 */

	private EntryLibary entries;
	private UserLibary userlibary;
	private ResourceLibary resourcelibary;
	private MethodLibary methodlibary;
	private StatusLibary statuslibary;
	private long datasize;
	private int lines;
	private long processtime;
	
	private ApacheReader apachereader;
	
	/**
	 * 
	 * @param apachereader reads the log
	 */
	
	public ApacheLog(ApacheReader apachereader) {
		this.apachereader = apachereader;
		entries = new EntryLibary();
		userlibary = new UserLibary();
		resourcelibary = new ResourceLibary();
		methodlibary = new MethodLibary();
		statuslibary = new StatusLibary();
		datasize = 0;
		lines = 0;
		processtime = 0;
	}

	/**
	 * 
	 * @return returns all Log Entries in an EntryLibary
	 */
	public EntryLibary getEntries() {
		return entries;
	}

	/**
	 * 
	 * @param entries sets this EntryLibary
	 */
	public void setEntries(EntryLibary entries) {
		this.entries = entries;
	}
	
	/**
	 * 
	 * @return returns all Users in an UserLibary
	 */
	public UserLibary getUserlibary() {
		return userlibary;
	}
	
	/**
	 * 
	 * @return returns the number of lines
	 */
	public int getLines() {
		return lines;
	}
	
	/**
	 * increments the number of lines
	 */
	public void incrementLines() {
		lines++;
	}

	/**
	 * 
	 * @param lines sets the number of lines
	 */
	public void setLines(int lines) {
		this.lines = lines;
	}

	/**
	 * 
	 * @param userlibary sets this UserLibary
	 */
	public void setUserlibary(UserLibary userlibary) {
		this.userlibary = userlibary;
	}

	/**
	 * 
	 * @return returns all Resources in a ResourceLibary
	 */
	public ResourceLibary getResourcelibary() {
		return resourcelibary;
	}

	/**
	 * 
	 * @param resourcelibary sets this ResourceLibary
	 */
	public void setResourcelibary(ResourceLibary resourcelibary) {
		this.resourcelibary = resourcelibary;
	}
	
	/**
	 * 
	 * @return returns all Methods in a MethodLibary
	 */
	public MethodLibary getMethodlibary() {
		return methodlibary;
	}

	/**
	 * 
	 * @param methodlibary sets this MethodLibary
	 */
	public void setMethodlibary(MethodLibary methodlibary) {
		this.methodlibary = methodlibary;
	}

	/**
	 * 
	 * @return retruns all Status Messages in a StatusLibary
	 */
	public StatusLibary getStatuslibary() {
		return statuslibary;
	}
	
	/**
	 * 
	 * @param statuslibary sets this StatusLibary
	 */
	public void setStatuslibary(StatusLibary statuslibary) {
		this.statuslibary = statuslibary;
	}

	/**
	 * 
	 * @return returns the total size of all data
	 */
	public long getDatasize() {
		return datasize;
	}

	/**
	 * 
	 * @param datasize sets this total size
	 */
	public void setDatasize(long datasize) {
		this.datasize = datasize;
	}
	
	/**
	 * 
	 * @param size add a specific amount of data size to total data size
	 */
	public void addData(int size) {
		datasize += size;
	}

	/**
	 * 
	 * @return returns the process time of analyzing the log
	 */
	public long getProcesstime() {
		return processtime;
	}

	/**
	 * 
	 * @param processtime sets this process time
	 */
	public void setProcesstime(long processtime) {
		this.processtime = processtime;
	}

	/**
	 * 
	 * @return returns the log reader 
	 */
	public ApacheReader getApachereader() {
		return apachereader;
	}

	/**
	 * 
	 * @param apachereader sets this log reader
	 */
	public void setApachereader(ApacheReader apachereader) {
		this.apachereader = apachereader;
	}

}
